﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Practices.Unity;
using Might.Infrastructure.ModelicaDOM;
using Might.Infrastructure.Services;
using Might.Infrastructure.View;
using Might.Infrastructure.DOM;

namespace Might.GraphicsEditor {
    public partial class CodeEditor : ITabEditor {

        internal IDomNode node;
        internal IUnityContainer container;

        /// <summary>
        /// Public default constructor for class DrawCanvas.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="ct">Graphic Annotation to be used in this canvas.</param>
        public CodeEditor(IUnityContainer container, IDomNode node) {
            InitializeComponent();

            this.container = container;
            this.node = node;
        }


        #region ITabEditor Members

        public void TabSelected() {

            // TODO replace with real code editor :)
            var langSvc = (IModelicaLanguageService)container.Resolve(typeof(IModelicaLanguageService));
            CodeBox.Text = langSvc.GetSourceForModelicaClass(node as IModelicaClass );

            /* CodeBox.Text += "InheritsFrom" + Environment.NewLine;
            foreach (var aa in ct.InheritsFrom) {
                CodeBox.Text += "    " + aa + Environment.NewLine;
            }

            CodeBox.Text += "BaseClassFor" + Environment.NewLine;
            foreach (var aa in ct.BaseClassFor) {
                CodeBox.Text += "    " + aa + Environment.NewLine;
            }

            CodeBox.Text += "annotations" + Environment.NewLine;
            foreach (var aa in ct.annotations) {
                CodeBox.Text += "    " + aa + Environment.NewLine;
            } */
        }

        #endregion
    }
}
